package edu.predatorwars.shared.models;

import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonProperty;


public class Player 
{
	private Creature creature;
	private PlayerConnectionInfo commInfo;
	private PlayerStatus status;
	private float[] color;
	
	@JsonCreator
	public Player(@JsonProperty("commInfo") PlayerConnectionInfo commInfo, @JsonProperty("color") float[] color)
	{
		this.commInfo = commInfo;
		this.status = PlayerStatus.JOINING;
                this.color = color;
	}
	
       public float[] getColor() {
		return color;
	}
        
	public void setColor(float r,float g, float b) {
		color[0] = r;
		color[1] = g;
		color[2] = b;
	}
	
	
	public PlayerConnectionInfo getCommInfo()
	{
		return commInfo;
	}
	
	public void setCreature(Creature creature)
	{
		this.creature = creature;
	}
	
	public Creature getCreature()
	{
		return creature;
	}
	
	public PlayerStatus getPlayerStatus() {
		return status;
	}
	
	public void setPlayerStatus(PlayerStatus status) {
		this.status = status;
	}
	
	
	
	@Override public boolean equals(Object object) {
		if (!(object instanceof Player)) {
			return false;
		}
		Player player = (Player)object;
		return commInfo.equals(player.commInfo);
	}
	
}
